<template>
    <section>

        <van-list
                v-model="loading"
                :finished="finished"
                finished-text="没有更多了"
                @load="onLoad"
        >
            <!-- <van-cell v-for="(item, index) in dataType" :key="item" :title="index" /> -->
            <!--<div class="detail-form-list-div"  v-for="(item, index) in dataType" :key="index">-->

            <!--</div>-->
            <div class="facility-detail-tab"  v-for="(item, index) in dataType" :key="index">
                <div class="facility-detail-tab-top">
                    <div class="facility-detail-tab-top-left">
                        <img class="facility-detail-tab-top-img" src="../../../../assets/icon-time.png" />
                        <div>2020-03-07</div>
                        <img class="facility-detail-tab-top-img2" src="../../../../assets/icon-tel.png" />
                    </div>
                    <div @click="showChange2(index)">
                        <img class="facility-detail-tab-top-img3" src="../../../../assets/icon-bottom.png" />
                    </div>
                </div>

                <div  v-show="index == tabIdx">
                    <div class="facility-detail-tab-top-line2"></div>
                    <div class="facility-detail--con">设备名称</div>
                    <div class="facility-detail-tps">
                        <div class="facility-detail-tps-div">
                            <div class="facility-detail-tps-div-name">设备型号:</div>
                            <!--<div  class="facility-detail-tps-div-msg">{{data.equipmentModel}}</div>-->
                        </div>
                        <div class="facility-detail-tps-div">
                            <div class="facility-detail-tps-div-name">设备功率:</div>
                            <!--<div  class="facility-detail-tps-div-msg">{{useTime}}天</div>-->
                        </div>
                        <div class="facility-detail-tps-div">
                            <div class="facility-detail-tps-div-name">操作类型:</div>
                            <!--<div  class="facility-detail-tps-div-msg">{{data.equipmentPower}}</div>-->
                        </div>
                        <div class="facility-detail-tps-div">
                            <div class="facility-detail-tps-div-name">操作:</div>
                            <!--<div  class="facility-detail-tps-div-msg">{{data.equipmentState | formatData}}</div>-->
                        </div>
                        <div  class="facility-detail-tps-div-t">
                            <div class="facility-detail-tps-div-name">初次使用日期:</div>
                            <!--<div  class="facility-detail-tps-div-msg">{{data.firstUseTime | firstUseTime}}</div>-->
                        </div>
                    </div>
                    <div class="facility-detail-tab-top-line2"></div>
                    <div class="detail-form-tipscon">
                        <div class="detail-form-tips-con">操作人:</div>
                        <div class="detail-form-tips-con">报表来源:来源 移动端</div>
                        <!--<div class="detail-form-tips-con">报表来源:来源<span v-if="item.source == 0">移动端</span><span v-else>pc端</span></div>-->
                    </div>
                </div>
                <div class="facility-detail-tab-top-line"  v-show="index !== tabIdx"></div>
                <div class="facility-detail-tabs"  v-show="index !== tabIdx">
                    <div class="facility-detail-tabs-name">设备报表</div>
                    <div class="facility-detail-tabs-line"></div>
                    <div class="facility-detail-tabs-t">
                        <div class="facility-detail-tabs-tips">保养</div>
                        <div class="facility-detail-tabs-tips">操作</div>
                    </div>
                </div>
            </div>
        </van-list>
    </section>
</template>

<script>
import { getDate } from '../../../../api/unit.js'
export default {
  props: {
    dataType: Array,
    tabIdx: Number,
    pageCount: Number,
    pageSize: Number
  },
  data () {
    return {
      loading: false,
      finished: false
    }
  },
  filters: {
    format: function (value) {
      return getDate(value).nTime
    }
  },
  methods: {
    onLoad () {
      setTimeout(() => {
        if (this.dataType.length < this.pageCount && this.pageCount > this.pageSize) {
          this.pageChange()
        }
        // 加载状态结束
        this.loading = false

        // 数据全部加载完成
        if (this.dataType.length >= this.pageCount) {
          this.finished = true
        }
      }, 1000)
    },
    showChange2 (index) {
      this.$emit('showChange', index)
    },
    pageChange () {
      this.$emit('pageChange')
    }
  }
}
</script>

<style scoped>
    .facility-detail-tab{
        margin-top: 16px;
        background: #fff;
        width: 690px;
        border-radius: 10px;
    }
    .facility-detail-tab-top{
        height: 95px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 32px;
        color: #9E9E9E;
        width: 690px;
    }
    .facility-detail-tab-top-left{
        display: flex;
        align-items: center;
    }
    .facility-detail-tab-top-img{
        width: 35px;
        height: 35px;
        margin-left: 37px;
        margin-right: 19px;
    }
    .facility-detail-tab-top-img2{
        width: 14px;
        height: 20px;
        margin-left: 23px;
    }
    .facility-detail-tab-top-img3{
        width: 22px;
        height: 12px;
        margin-right: 54px;
    }
    .facility-detail-tab-top-line{
        width:690px;
        height:2px;
        background: #000;
        opacity:0.14;
    }
    .facility-detail-tab-top-line2{
        width:590px;
        margin-left: 50px;
        height:2px;
        background: #000;
        opacity:0.14;
    }
    .facility-detail--con{
        color: #202020;
        font-size: 30px;
        font-weight: bold;
        margin-left: 50px;
        margin-top: 45px;
    }
    .facility-detail-tabs{
        display: flex;
        align-items: center;
        padding: 14px 0 9px 0;
    }
    .facility-detail-tabs-name{
        font-size: 34px;
        color: #202020;
        margin-left: 38px;
    }
    .facility-detail-tabs-line{
        width:2px;
        height:80px;
        opacity:0.14;
        background: #000;
        margin: 0 24px;
    }
    .facility-detail-tabs-tips{
        font-size: 26px;
        color: #9E9E9E;
        padding: 7px 12px;
        border: 2px solid #DEDBDE;
        border-radius:6px;
        margin-right: 13px;
    }
    .facility-detail-tabs-t{
        display: flex;
    }
    .facility-detail-tps{
        /*width: 590px;*/
        margin-left: 50px;
        display: flex;
        flex-wrap: wrap;
    }
    .facility-detail-tps-div{
        display: flex;
        margin-top: 29px;
        width: 285px;
        padding-left: 16px;
        font-size: 26px;
    }
    .facility-detail-tps-div-name{
        color: #202020;
        margin-right: 30px;
    }
    .facility-detail-tps-div-msg{
        color: #9E9E9E;
    }
    .facility-detail-tps-div-t{
        width: 500px;
        font-size: 26px;
        display: flex;
        padding-left: 16px;
        margin-top: 32px;
        margin-bottom: 39px;
    }
    .detail-form-tipscon{
        margin-left: 50px;
        display: flex;
        font-size: 26px;
        color: #9e9e9e;
        margin-top: 30px;
        padding-bottom: 42px;
    }
    .detail-form-tips-con{
        width: 300px;
    }
</style>
